package ObjectTest;

import com.study.optional.Boy;
import com.study.optional.Girl;
import org.junit.Test;

/**
 * @author yangyanbin
 * @since 20221205
 **/
public class getObject {

    @Test
    public void test() {
        Girl type = (Girl) getType(2);
        System.out.println(type);
    }

    private Object getType(Integer number) {
        if (number.equals(1)) {
            Girl girl = new Girl();
            girl.setName("yyb");
            return girl;
        }
        Boy boy = new Boy();
        boy.setGirl(new Girl("tty"));
        return boy;
    }
}
